package cn.nfwx.tv.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

public class TvChannel implements Parcelable {


    private String requestReviewVodCommand;

    /**
     * url : http://southtv.kmdns.net:2935/cctv1/live.m3u8
     * enable_vod : 1
     * gid : cctv1
     * name : 中央1套
     * logo : http://southtv.kmdns.net:2935/logo/channel_14.jpg
     */

    private String url;
    private int enable_vod;
    private String gid;
    private String name;
    private String logo;
    private boolean pure_audio;

    private TvProgram playingProgram;
    private List<TvProgram> tvPrograms = new ArrayList<>();
    private List<DateProgram> datePrograms =new ArrayList<>();

    /**
     * program_name : 巅峰音乐会
     */
    private String program_name;

    public TvChannel() {

    }

    protected TvChannel(Parcel in) {
        url = in.readString();
        enable_vod = in.readInt();
        gid = in.readString();
        name = in.readString();
        logo = in.readString();
        pure_audio = in.readByte() != 0;
        program_name = in.readString();
    }

    public static final Creator<TvChannel> CREATOR = new Creator<TvChannel>() {
        @Override
        public TvChannel createFromParcel(Parcel in) {
            return new TvChannel(in);
        }

        @Override
        public TvChannel[] newArray(int size) {
            return new TvChannel[size];
        }
    };

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public int getEnable_vod() {
        return enable_vod;
    }

    public void setEnable_vod(int enable_vod) {
        this.enable_vod = enable_vod;
    }

    public String getGid() {
        return gid;
    }

    public void setGid(String gid) {
        this.gid = gid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getProgram_name() {
        return program_name;
    }

    public void setProgram_name(String program_name) {
        this.program_name = program_name;
    }

    public List<TvProgram> getTvPrograms() {
        return tvPrograms;
    }

    public void setTvPrograms(List<TvProgram> tvPrograms) {
        this.tvPrograms.clear();
        this.tvPrograms.addAll(tvPrograms);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(url);
        dest.writeInt(enable_vod);
        dest.writeString(gid);
        dest.writeString(name);
        dest.writeString(logo);
        dest.writeByte((byte) (pure_audio ? 1 : 0));
        dest.writeString(program_name);
    }

    public boolean isPure_audio() {
        return pure_audio;
    }

    public void setPure_audio(boolean pure_audio) {
        this.pure_audio = pure_audio;
    }

    public TvProgram getPlayingProgram() {
        return playingProgram;
    }

    public void setPlayingProgram(TvProgram playingProgram) {
        this.playingProgram = playingProgram;
    }

    public synchronized List<DateProgram> getDatePrograms() {
        return datePrograms;
    }

    public synchronized void setDatePrograms(List<DateProgram> datePrograms) {
        this.datePrograms = datePrograms;
    }
}
